<?php


class DB_SHORT_URL_SHARE_COUNTS extends ORM_Table {

    static protected $table_name = 'short_url_share_counts';

    static public function getTableName($params = null) {
        //$table_name = self::$table_name.substr($params['article_type_id'], 0, 1);
        return self::$table_name;
    }
    /**
     * 创建记录
     */
    static public function created_record($url) {
        $u  = new DB_SHORT_URL_SHARE_COUNTS();
        $u->setUrl($url);
        $u->setCounts(0);
        $u->save();
        return $u;
    }
    

    static public function showTotal($url) {
        $rs = DAO_Finder::findOne(DB_SHORT_URL_SHARE_COUNTS, array('url' => $url), 'counts');
        if($rs){
            return $rs->getCounts();
        }else{
            return 0;
        }
    }
}

